<template>
    <div class="child2">这是child1组件内容

        <h1>这是child2---{{$store.state.count}}</h1>

        <el-button @click="child2Add">child2自增</el-button>
        
    </div>
</template>

<script>
export default {
   
    data() {
        return{}
    },
    methods:{
        child2Add() {
            //this.childValue++
            //
            this.$store.commit('addCount')

        }

        }
    }

</script>

<style scoped lang="scss">
.child2{
    width: 300px;
    height: 200px;
    border: 2px solid red;
}
</style>